//
//  NetAPI+HomeAPI.m
//  AppleMarket
//
//  Created by yangy on 19/10/2018.
//  Copyright © 2018 szgsy. All rights reserved.
//

#import "NetRequest+HomeAPI.h"

@implementation NetRequest (HomeAPI)
+ (void) request_GetBannerWithCompleteHandler:(void (^)(id responseObj)) completeHandler
                                         fail:(void (^)(NSError *error)) failHandler
{
    [self getWithUrl:@"/api/HomeApi/GetBanners" parameters:nil success:^(id response) {
        completeHandler(response);
    } fail:^(NSError *error) {
        failHandler(error);
    } showHUD:NO];
}

+ (void) request_GetNewsListWithCompleteHandler:(void (^)(id responseObj)) completeHandler
                                           fail:(void (^)(NSError *error)) failHandler
{
    
    [self getWithUrl:@"/api/DocApi/GetHomeNewsList" parameters:nil success:^(id response) {
        completeHandler(response);
    } fail:^(NSError *error) {
        failHandler(error);
    } showHUD:NO];
}

+ (void) request_GetNewsListWithPageIndex:(NSInteger) index
                                   typeId:(NSInteger) typeId
                          completeHandler:(void (^)(id responseObj)) completeHandler
                                     fail:(void (^)(NSError *error)) failHandler
{
    NSDictionary *dict = @{
                           @"pageIndex" : @(index),
                           @"typeId" : @(typeId)
                           };
    [self getWithUrl:@"/api/DocApi/GetNewsList" parameters:dict success:^(id response) {
        completeHandler(response);
    } fail:^(NSError *error) {
        failHandler(error);
    } showHUD:NO];
}
@end
